package com.tang.algorithm.array;/**
 * @author tlm
 * @date 2020/6/11 22:59
 * @version 1.0
 */



public class LeetCode739 {


    public static void main(String[] args) {
        LeetCode739 leetCode739 = new LeetCode739();
        int[] a= {73, 74, 75, 71, 69, 72, 76, 73};
        int[] res = leetCode739.dailyTemperatures(a);
        for (int i = 0; i <res.length ; i++) {
            System.out.println(res[i]);

        }
    }
    /*
    暴力法：不推荐
     */
    public int[] dailyTemperatures(int[] T) {
        int size = T.length;
        int[] res = new int[size];
        int count = 0;
        for (int i = 0; i <size ; i++) {
            for (int j = i+1; j <size ; j++) {
                if(T[j]>T[i]){
                    count=j-i;
                    res[i]=count;
                    break;
                }

            }
        }
        return res;
    }
}
